<?php
/**
 * Description of log
 *
 * @author Henson
 */
class Log extends Base{
	
	private $logTable = "tbl_log";
	
	public function insertLog($insertArr)
	{
		$insertArr['sid'] = $_COOKIE['r_uid'];
		$insertArr['sname'] = $_COOKIE['r_name'];
		$insertArr['insert_time'] = time();
		$insertArr['del'] = '0';
		return $this->db->insert($insertArr, $this->logTable);
	}
	
	public function getLogTotal()
	{
		$where = "where del='0'";
		return $this->getTotalNum($this->logTable, $where);
	}
	
	public function getLogList($where, $orderby, $limit)
	{
		$sql = "select * from $this->logTable {$where} {$orderby} {$limit}";
		$this->db->setQuery($sql);
		return $this->db->loadAssocList();
	}
	
	public function dealLog($log)
	{
		$log['time'] = date("Y-m-d H:i:s", $log['insert_time']);
		return $log;
	}
}
?>
